class _LocalCache {
  getItem(key: string) {
    const value = window.localStorage.getItem(key);
    if (value) {
      return JSON.parse(value);
    }
  }

  getItems(keys: string[]) {
    const obj: any = {};
    keys.forEach((key) => {
      let value = window.localStorage.getItem(key);
      obj[key] = value;
    });
    return obj;
  }

  setItem(key: string, value: any) {
    window.localStorage.setItem(key, JSON.stringify(value));
  }
}

const LocalCache = new _LocalCache();

export { LocalCache };
